﻿<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
  <script>
     //查找HTML元素
     var x = document.getElementById("id名"); //通过id找元素
	 var y = document.getElementsByTagName("id名");//通过标签名来找元素
	 var z = document.getElementsByClassName("id名");//通过类名来找元素
     //改变HTML内容
     document.getElementById("id名").innerHTML = "新的html内容"
	 document.getElementById("id名").innerText = "新的文本内容";
     //改变HTML属性
     document.getElementById("id名").attribute = "新的属性值";
     //改变HTML样式
	 document.getElementById("id名").style.property = "新的样式";
	 //创建元素节点
	 var div = document.createElement("div");
	 div.innerHTML = "内容";
	 document.body.appendChild(div);
	 //删除元素节点
	 div.setAttribute("id","id值");
	 var div1 = document.getElementById("id值");
	 document.body.removeChild(div1);
	   
  </script>
 </head>
 <body>
    <div></div>  
 </body>
</html>
